// 编辑页的入口文件
import React, { useEffect, useState } from "react";
import { getQuestionService } from "../../../services/question";
import EditCanvasShow from "./EditCanvasShow";
import style from './index.module.scss'
import { useLoadQuestionComponentsData } from "../../../hooks/useLoadQuestionData";

export default function Edit() {
  // const { id = "" } = useParams();
  // console.log(id, "获取动态路由 ID");
  // // 进入页面时会请求本条问卷的相关数据，避免网络延迟造成的空白页，加一个loading
  // const [loading, setLoading] = useState(true);
  // const [questionData, setQuestionData] = useState({});
  // useEffect(() => {
  //   async function fn() {
  //     const data = await getQuestionService(id);
  //     setLoading(false)
  //     setQuestionData(data)
  //     // console.log("edit page data", data);
  //   }
  //   fn();
  // }, []);
  const {loading} = useLoadQuestionComponentsData()

  return (
    <div className={style.container}>
      <div style={{height:'20px' ,backgroundColor:'yellow'}}>Header</div>

      <div className={style['container-wrapper']}>
        <div className={style.content}>

          <div className={style.left}>left</div>

          <div className={style.main}>
            <div className={style['canvas-wrapper']} >
              {/* 画布组件 */}
              <EditCanvasShow loading={loading}/>
            </div>
          </div>

          <div className={style.right}>right</div>
        </div>
      </div>
    </div>
  );
}
